<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="lib/swiper.min.css">
  <style>
    .swiper-container {
      height: 300px;
      border: 1px solid #f66;
    }
  </style>
</head>
<body>
  <div id="app">
    <my-swiper></my-swiper>
  </div>
</body>
<template id="swiper">
  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide" v-for="item of bannerList" :key="item.bannerid">
        <img :src="item.img" alt="">
      </div>
    </div>
  </div>
</template>
<script src="lib/swiper-bundle.js"></script>
<script src="lib/vue.js"></script>
<script>
  const MySwiper = {
    template: '#swiper',
    data () {
      return  {
        bannerList: []
      }
    },
    mounted () {
      // http://121.89.205.189/apidoc/
      fetch('http://121.89.205.189/api/banner/list')
        .then(res => res.json())
        .then(res => {
          console.log(res)
          this.bannerList = res.data
          
        })
    },
    updated() {
      // new Swiper实例
      new Swiper('.swiper-container',{})
    },
  }
  new Vue({
    el: '#app',
    components: {
      'my-swiper': MySwiper
    }
  })
</script>
</html>